﻿using System;
using System.ComponentModel;
using Mbs.ComponentModel.Container.Metadata;

namespace Mbs.ComponentModel.Container.Listner
{
    [Serializable]
    public class SupportInitializeListner:KernelListnerAdapter
    {
        private SupportInitializeListner() : base(LifestyleStage.Created) { }

        public static readonly IKernelListner Instance = new SupportInitializeListner();

        public override void OnCreated(IComponentInfo info, object instance)
        {
            var supportInit = instance as ISupportInitialize;
            if (supportInit != null)
            {
                supportInit.BeginInit();
                supportInit.EndInit();
            }
        }
    }
}
